package tech.aistar.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import tech.aistar.pojo.Product;
import tech.aistar.service.ProductService;

import java.util.List;

@Controller
@RequestMapping("/product")
public class ProductController {


    @Autowired
    private ProductService productService;

    @RequestMapping("/list")
    public String list(Model model) {
        List<Product> productList = productService.list();
        model.addAttribute("productList", productList);
        return "shop";
    }

}

